设置集合地点

chengzhenyu 8 年 前
コミット
d3810b20ca

+ 15 - 1
app/src/main/java/ai/pai/client/activity/MainActivity.java

@@ -61,6 +61,8 @@ public class MainActivity extends AppCompatActivity
61 61
     private PersonInfoPopup personInfoPopup;
62 62
     private ImageButton callGuideBtn;
63 63
     private ImageButton gatherBtn;
64
+    private TextView gatherInfoTextView;
65
+
64 66
     @Override
65 67
     protected void onCreate(Bundle savedInstanceState) {
66 68
         super.onCreate(savedInstanceState);
@@ -91,6 +93,7 @@ public class MainActivity extends AppCompatActivity
91 93
         ImageView drawerToggle = (ImageView) findViewById(R.id.drawer_toggle);
92 94
         PhotoLoader.getInstance(this).displayImage(Preferences.getInstance(this).getUserAvatar(), drawerToggle,PhotoLoader.getUserAvatarOptions());
93 95
         drawerToggle.setOnClickListener(this);
96
+        gatherInfoTextView = (TextView)findViewById(R.id.tv_gather_info);
94 97
         callGuideBtn = (ImageButton)findViewById(R.id.floating_btn_call);
95 98
         gatherBtn = (ImageButton)findViewById(R.id.floating_btn_gather);
96 99
         findViewById(R.id.floating_btn_add).setOnClickListener(this);
@@ -176,7 +179,18 @@ public class MainActivity extends AppCompatActivity
176 179
     public void onClick(View v) {
177 180
         switch (v.getId()) {
178 181
             case R.id.floating_btn_gather:
179
-                Toast.makeText(MainActivity.this, TimeUtils.getGatherTimeStr(Preferences.getInstance(this).getGatherTime()),Toast.LENGTH_SHORT).show();
182
+                gatherInfoTextView.setVisibility(gatherInfoTextView.getVisibility()== View.VISIBLE?View.INVISIBLE:View.VISIBLE);
183
+                gatherInfoTextView.setText(getString(R.string.gather_info,TimeUtils.getGatherTimeStr(Preferences.getInstance(this).getGatherTime()),Preferences.getInstance(this).getTourGatherLocation()));
184
+                if(gatherInfoTextView.getVisibility()==View.VISIBLE){
185
+                    gatherInfoTextView.postDelayed(new Runnable() {
186
+                        @Override
187
+                        public void run() {
188
+                            if(gatherInfoTextView!=null && gatherInfoTextView.getContext()!=null){
189
+                                gatherInfoTextView.setVisibility(View.INVISIBLE);
190
+                            }
191
+                        }
192
+                    },3000);
193
+                }
180 194
                 break;
181 195
             case R.id.floating_btn_add:
182 196
                 new GroupSelectPopup(MainActivity.this).showPopupWindow();

+ 9 - 0
app/src/main/java/ai/pai/client/db/Preferences.java

@@ -43,6 +43,15 @@ public class Preferences {
43 43
         return mPrefs.getString("userName",NullStr);
44 44
     }
45 45
 
46
+    public void setTourGatherLocation(String gatherLocation){
47
+        mPrefs.edit().putString("gatherLocation",gatherLocation).commit();
48
+    }
49
+
50
+    public String getTourGatherLocation(){
51
+        return mPrefs.getString("gatherLocation",NullStr);
52
+    }
53
+
54
+
46 55
     public void setTourGuidePhone(String phone){
47 56
         mPrefs.edit().putString("tour_phone",phone).commit();
48 57
     }

+ 5 - 0
app/src/main/java/ai/pai/client/fragments/TabRecentPhotoFragment.java

@@ -153,6 +153,10 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh
153 153
                             Preferences.getInstance(context).setTourGuidePhone(phone);
154 154
                             String gatherTimeStr = group.getString("gather_at");
155 155
                             Preferences.getInstance(context).setGatherTime(TimeUtils.getStandardTimeInMiliSec(gatherTimeStr));
156
+                            if(group.has("gather_location")){
157
+                                String location = group.getString("gather_location");
158
+                                Preferences.getInstance(context).setTourGatherLocation(location);
159
+                            }
156 160
                             String endTimeStr = group.getString("ended_at");
157 161
                             Preferences.getInstance(context).setTourEndTime(TimeUtils.getStandardTimeInMiliSec(endTimeStr));
158 162
                         }
@@ -161,6 +165,7 @@ public class TabRecentPhotoFragment extends BaseFragment implements SwipeRefresh
161 165
                         Preferences.getInstance(context).setTourGuidePhone("");
162 166
                         Preferences.getInstance(context).setGatherTime(0);
163 167
                         Preferences.getInstance(context).setTourEndTime(0);
168
+                        Preferences.getInstance(context).setTourGatherLocation("");
164 169
                     }
165 170
                     return true;
166 171
                 }catch (Exception e){

+ 5 - 0
app/src/main/java/ai/pai/client/services/MyLocationService.java

@@ -149,8 +149,13 @@ public class MyLocationService extends Service implements Handler.Callback{
149 149
                             Preferences.getInstance(context).setGatherTime(TimeUtils.getStandardTimeInMiliSec(gatherTimeStr));
150 150
                             String endTimeStr = group.getString("ended_at");
151 151
                             Preferences.getInstance(context).setTourEndTime(TimeUtils.getStandardTimeInMiliSec(endTimeStr));
152
+                            if(group.has("gather_location")){
153
+                                String location = group.getString("gather_location");
154
+                                Preferences.getInstance(context).setTourGatherLocation(location);
155
+                            }
152 156
                         }
153 157
                     }else{
158
+                        Preferences.getInstance(context).setTourGatherLocation("");
154 159
                         Preferences.getInstance(context).setTourMode(false);
155 160
                         Preferences.getInstance(context).setTourGuidePhone("");
156 161
                         Preferences.getInstance(context).setGatherTime(0);

+ 17 - 2
app/src/main/res/layout/app_bar_main.xml

@@ -47,7 +47,22 @@
47 47
         android:layout_marginBottom="66dp"
48 48
         android:visibility="invisible"
49 49
         android:background="@drawable/ic_gather"/>
50
-
51
-
50
+    
51
+  
52
+    <TextView
53
+        android:id="@+id/tv_gather_info"
54
+        android:layout_width="wrap_content"
55
+        android:layout_height="wrap_content"
56
+        android:layout_gravity="bottom|start"
57
+        android:gravity="center"
58
+        android:textSize="16sp"
59
+        android:padding="10dp"
60
+        android:minHeight="60dp"
61
+        android:visibility="invisible"
62
+        android:textColor="@color/dark_grey"
63
+        android:layout_marginRight="80dp"
64
+        android:layout_marginLeft="80dp"
65
+        android:layout_marginBottom="66dp"
66
+        android:background="@drawable/round_edittext"/>
52 67
 
53 68
 </android.support.design.widget.CoordinatorLayout>

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -244,4 +244,6 @@
244 244
     <string name="guide_app_input_phone">请输入电话以便导游途中联系</string>
245 245
 
246 246
     <string name="guide_app_join_tour">加入旅行团</string>
247
+
248
+    <string name="gather_info">请%1$s前到%2$s集合</string>
247 249
 </resources>